import os
import sys

from loguru import logger

if '--debug' in sys.argv:
    # debug 模式
    logger.level('DEBUG')
else:
    # release 模式
    logger.level('INFO')

script_path = os.path.abspath(os.path.dirname(sys.argv[0]))
log_path = os.path.join(script_path, 'error.log')
logger.add(log_path, rotation='500 MB', level='WARNING', mode='w')
